package cn.kbblog.activemq;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class QueueReceiver2 implements MessageListener {

	private static final Logger LOGGER = LoggerFactory.getLogger(QueueReceiver2.class);
	
	@Override
	public void onMessage(Message arg0) {
		TextMessage txtMessage = (TextMessage)arg0;
        try {
        	String msg = "QueueReceiver2 get message " + txtMessage.getText();
        	System.out.println(msg);
            LOGGER.info (msg);
        } catch (JMSException e) {
            LOGGER.error("error {}", e);
        }
	}

}
